RippleDirBrowserWrapper{
	classvar dirs, mainwindow, files, allPaths, selectedFilePath, selectedFileName, parent, currentFileList;
	
	*getSelectedFilePath{
		"+++++++++++++++++++++++++++++++++++++++ dirs ++++++++++++++++++++++++++++++++++".postln;
		dirs.postln;
		^dirs.getSelectedFilePath;
	}
	
	*setParent{|parentArg|
		parent = parentArg;
	}
	
	*getSelectedFileName{
		//^selectedFileName
		^currentFileList.items.at( files.value )
	}
	
	*init{|mainwindowArg|
		mainwindow = mainwindowArg;
		this.makeUIElements;		
	}
	
	*refresh{
		dirs.refresh;
	}	
	
	*defaultDir_{|dirArg|
		dirs.defaultDir = dirArg;
	}
	
	*defaultDir{
		^dirs.defaultDir;
	}
	
	*currentDir{
		^dirs.currentDir;
	}
	
	*currentDir_{|dir|
		dirs.currentDir_(dir)
	}
	
	*makeUIElements{
		var t;
		
		t = SCStaticText(mainwindow, 150 @ 23);
		t.string =  "Choose Sample";
		t.font = Font("Arial Bold", 18);
		t.stringColor = RippleGuiConstants.bigTextColor;
		
		
		mainwindow.decorator.nextLine;
		/* spacer */ SCStaticText(mainwindow, 5 @ 5);
		mainwindow.decorator.nextLine;
	
		dirs = RippleDirBrowser(mainwindow)
			.font_(RGuiCnst.getDefaultFont)
			.background_(RippleGuiConstants.getShadeColor)
			.canFocus_(false);
	
	
	
	}
	
	*getDirs {	
		var d;
		d = "sounds/*".pathMatch.collect({ arg p; PathName(p).folderName });
		^d;
	}
	
	*getPaths { arg dir;
		^(Sample.dir++(dir)++"/*").pathMatch
			.select({ arg x;
				var pt,xt;
				pt = PathName(x);
				xt = pt.extension;
				pt.fileName != "_dir" and: (xt == "aiff" or: {xt=="aif"} or: {xt == "wav"} or: {xt==""})
			});
	}
}